:- module(page_definitions, [page_data/4], [functions]).

:- use_module(amos(configuration), [wdbn/1,wdbn_url/1]).
:- use_module(library(lists), [append/3]).

add_to_webdb(WebDbRes, WebDBPlace):-
        wdbn_url(WebDBRoot), 
        atom_codes(WebDBRoot, WebDBRootCodes),
        append(WebDBRootCodes, WebDbRes, WebDBPlace).

 %% Data to enter:
 %%
 %% page_data(PageIdentifier,
 %%           PageTitle,
 %%           LocalizationMethod,
 %%           StructureName).

%% Main page.
page_data(index, "Welcome to the AMOS site!", add_to_root, box_main).

%% General information.
page_data(information, "Project Information", add_to_root, box_information).
%% 
page_data(project_aims, "Project Objectives and Methods", 
        add_to_root, box_information).

page_data(partners, "About the Project Partners",add_to_root, box_information).

page_data(admin_info, "Administration Guide", add_to_root, box_administration).

page_data(search_info, "Searching Explained", add_to_root, box_search).

%% Pages generated by the search process.
page_data(match, _, add_to_cgi, box_search).
page_data(search_explained, "What Can I Search for?", 
        add_to_root, box_search_basic).
page_data(search_error_explained, "What Are These Errors?",
        add_to_root, box_search_error).
page_data(search_desc_explained, "What Are These Terms?",
        add_to_root, box_term_desc_page).
 %% page_data(amos_explained, "Amos Explained",
 %%         add_to_root, box_amos_explained).

%% Entry page to the administration pages
page_data(administration, "Administration Page",
        add_to_root, box_administration).

%% Page to start up the server
page_data(server_procedures, "Server Maintenance Procedures", 
        add_to_root, box_administration).

%% General WebDB page
%% page_data(about_amos, "The Amos Project", add_to_root, box_about_amos).
 %% page_data(news, "News",
 %%         add_to_root, box_news).
page_data(tech_rep, "Technical Information", add_to_root, box_main).
page_data(getting_sources, "Getting the Source Code of Amos",
        add_to_root, box_getting_sources).
page_data(amos_gentle, "A Gentle Introduction to Amos",
        add_to_root, box_information).



page_data(description, _, 
              absolute(~add_to_webdb("/webdb_client.cgi?table_name=Software_Description_Request&service=query_modify_service&action=empty_form")), 
              box_webdb).


page_data(review, _, 
              absolute(~add_to_webdb("/admin/amos_reviewer_access.cgi")), 
              box_webdb).

page_data(dictionary, _, 
              absolute(~add_to_webdb("/admin/db_generic_client.cgi?table_name=Dictionary&service=query_modify_service&action=empty_form")), 
              box_webdb).

page_data(maintenance, _, 
%JMG              absolute(~add_to_webdb("/admin/db_maintenance.cgi")), 
%	      absolute(~add_to_webdb("/admin/db_generic_client.cgi?table_name=Administration&service=query_modify_service&action=overview&searchmode=normal")), 
	      absolute(~add_to_webdb("/admin/db_generic_client.cgi?table_name=Administration&service=query_modify_service&action=empty_form")), 
              box_webdb).

page_data(status, _, 
	      absolute(~add_to_webdb("/webdb_client.cgi?service=system_status_service")), 
              box_webdb).

page_data(dialogues, _, 
	      absolute(~add_to_webdb("/admin/db_generic_client.cgi?service=modify_options_service")), 
              box_webdb).

page_data(templates, _, 
	      absolute(~add_to_webdb("/admin/db_generic_client.cgi?service=reload_templates_service")), 
              box_webdb).

page_data(more_search, _, 
	      absolute(~add_to_webdb("/webdb_client.cgi?table_name=Administration&service=query_modify_service&action=empty_form")), 
              box_webdb).

page_data(download_amosdb, _, add_to_cgi, box_webdb).

page_data(upload_amosdb, _, absolute(~add_to_webdb("/admin/upload_amosdb.cgi")), box_webdb).

%% Skeletons of pages generated for WebDB

page_data(admin_content, "Administration Content Template", add_to_cgi, box_webdb).
page_data(admin_heading, "<V>title</V>", add_to_cgi, box_webdb).
page_data(consult_table_heading, "<V>table</V>", add_to_cgi, box_webdb).
page_data(main_page_heading, "<V>title</V>", add_to_cgi, box_webdb).

